package com.object;

//标准类的定义
public class Car {
    private String brandName;
    private double price;

    //定义无参构造函数
    public Car(){}

    /**
     * 定义带参数的构造函数
     * @param brandName 品牌
     * @param price 价格
     */
    public Car(String brandName,double price){
        this.brandName = brandName;
        this.price = price;
    }

    //成员方法
    public void setBrandName(String brandName) {
        this.brandName = brandName;
    }

    public String getBrandName() {
        return brandName;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public double getPrice() {
        return price;
    }

    //展示对象方法
    public void show(){
        System.out.println("{brandName:"+brandName+",price:"+price+"}");
    }
}
